package com.gongzuozhan.service.impl;

import com.gongzuozhan.pojo.BingLi;
import com.gongzuozhan.pojo.GuaHaoJiLu;
import com.gongzuozhan.mapper.GuaHaoJiLuMapper;
import org.springframework.stereotype.Service;
import com.gongzuozhan.service.GuaHaoJiLuService;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 患者挂号记录(GuaHaoJiLu)表服务实现类
 *
 * @author Gold
 * @since 2021-03-17 15:03:34
 * @version 1.0
 */
@Service("guaHaoJiLuService")
public class GuaHaoJiLuServiceImpl implements GuaHaoJiLuService {
    @Resource
    private GuaHaoJiLuMapper guaHaoJiLuMapper;

    /**
     * 查询所有数据
     * @return  返回所有数据
     */
    @Override
    public Map<String, Object> chaXunJinRi( String jiuZhenShiJian

                                         ) {


        long currenttime = System.currentTimeMillis();
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        String time = df.format(currenttime);
        jiuZhenShiJian = time;
        System.out.println(time);
        Map<String, Object> map = new HashMap<>();
        // 前端端分离时，前端人员会首先判断code值是否满足200，如果不是200，则提醒用户失败
        map.put("code", 200);
        map.put("msg", "查询成功");
        map.put("list", this.guaHaoJiLuMapper.chaXunJinRi(jiuZhenShiJian));
        return map;
    }

    /**
     * 查询所有数据
     * @return  返回所有数据
     */
	@Override
    public Map<String, Object> chaXunAll( String jiuZhenShiJianQiShi,
                                          String jiuZhenShiJianJieShu,
                                          String jiuZhenJiLuZhuangTai,
                                          String guaHaoDanHao,
                                          String xingMing) {
        Map<String, Object> map = new HashMap<>();
        // 前端端分离时，前端人员会首先判断code值是否满足200，如果不是200，则提醒用户失败
        map.put("code", 200);
        map.put("msg", "查询成功");
        map.put("list", this.guaHaoJiLuMapper.chaXunAll(jiuZhenShiJianQiShi,jiuZhenShiJianJieShu,jiuZhenJiLuZhuangTai,guaHaoDanHao,xingMing));
        return map;
    }


    /**
     * 查询单条数据
     * @return  返回所有数据
     */
    @Override
    public Map<String, Object> chaXunHuanZe( String guaHaoDanHao) {
        Map<String, Object> map = new HashMap<>();
        // 前端端分离时，前端人员会首先判断code值是否满足200，如果不是200，则提醒用户失败
        map.put("code", 200);
        map.put("msg", "查询成功");
        map.put("list", this.guaHaoJiLuMapper.chaXunHuanZe(guaHaoDanHao));

        return map;
    }

    /**
     * 通过guaDanDanHao更新单条数据
     *
     * @param guaDanDanHao 实例对象
     * @return 实例对象
     */
    @Override
    public Map<String, Object> gengXinById(String guaDanDanHao,Integer jiuZhenJiLuZhuangTai) {
        int a = 3;
        jiuZhenJiLuZhuangTai = a;
        this.guaHaoJiLuMapper.gengXinById(guaDanDanHao,jiuZhenJiLuZhuangTai);
        Map<String, Object> map = new HashMap<>();
        map.put("code", 200);   // 前端端分离时，前端人员会首先判断code值是否满足200，如果不是200，则提醒用户失败
        map.put("msg", "更新成功");
        return map;
}
    }